<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <style>
    body {
      background-color: #ffffff;
    }
  </style>
</head>
<body>
<table>
  <tbody>
  <tr>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
  </tr>
  <tr>
    <td>价格</td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td>库存</td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td>数量</td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  </tbody>
  <!--  <button id="eidt" style="width: 100px;height: 100px" >修改</button>-->
</table>
<button id="past">确定</button>
<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="https://code.jquery.com/jquery-3.0.0.min.js"></script>
<script>
  const http = localStorage.getItem('http')
  $.ajax({
    method:'GET',
    url:http+`/Potions/list`,
    async:false,
    success:function (data,status){
      shuju = data.data
    }
  })
  medicine=parent.medicine
  for (let i=0 ; i<shuju.length;i++)
  {
    let  tex = shuju[i]
    console.log(typeof (tex))
    medicine.Name.push(tex["potionName"])
    medicine.Price.push(tex["potionPrice"])
    medicine.Quantity.push(tex["potionQuantity"])
  }
  let n =-1;
  let j=0;
  var table = $("table")
  table.find("tr").each(function (){
    table.find("th").each(function (){

      const name =medicine.Name
      $(this).text(name[n])

      n++
    })
    if (j==1)
    {
      console.log("dsfadfas")
      var m = -1
      $(this).find("td").each(function (){
        const tee = medicine["Price"]
        $(this).text(tee[m])
        m++
      })
    }else if (j==2)
    {
      var m = -1
      $(this).find("td").each(function (){
        const tee = medicine["Quantity"]
        $(this).text(tee[m])
        m++
      })
    }else if (j==3){
      var m = -1
      $(this).find("td").each(function (){
        const tee = medicine["Num"]
        $(this).text(tee[m])
        m++
      })
    }
    j++
  })
  $("#past").on('click',function (){
    var index = parent.layer.getFrameIndex(window.name)
    parent.layer.close(index)
  })
</script>
<style>
  table {
    width: 100vw;
    height: 100vh;
    border-collapse: collapse;
    border: 2px solid rgb(140 140 140);
    font-family: sans-serif;
    font-size: 0.8rem;
    letter-spacing: 1px;
  }

  caption {
    caption-side: bottom;
    padding: 10px;
    font-weight: bold;
  }

  thead,
  tfoot {
    background-color: rgb(228 240 245);
  }

  th,
  td {
    border: 1px solid rgb(160 160 160);
    padding: 8px 10px;
  }

  td:last-of-type {
    text-align: center;
  }

</style>
</body>
</html>
